package utils.geom;

import java.awt.Point;

/**
 * Typ kierunkowy (cztery strony świata)
 * 
 * @author kasztan
 * @version 1.0
 */
public enum Direction
{
	NORTH(0), EAST(90), SOUTH(180), WEST(270);

	private final int rotation;

	private Direction(int rotation)
	{
		this.rotation = rotation;
	}

	public int getRotation()
	{
		return rotation;
	}
	
	public Direction getReversedDirection()
	{
		switch(rotation)
		{
			case 0:
				return Direction.SOUTH;
			case 90:
				return Direction.WEST;
			case 180:
				return Direction.NORTH;
			default:
				return Direction.EAST;
		}
	}

	public Point getDirectionPoint()
	{
		Point pt = new Point(0,0);
		switch (rotation)
		{
			case 0:
				pt.y--;
				break;
			case 90:
				pt.x++;
				break;
			case 180:
				pt.y++;
				break;
			case 270:
				pt.x--;
				break;
		}
		return pt;
	}
}